var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2BundleManager = require("BundleManager");
var $2EventsMgr = require("EventsMgr");
var $2Jiangshi = require("Jiangshi");
var $2DataManager = require("DataManager");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_PlayerBall = /* */function (_cc$Component57) {
  babel_inherits(d, _cc$Component57);
  var _super73 = babel_createSuper(d);
  function d() {
    var _this162;
    babel_classCallCheck(this, d);
    _this162 = _super73.apply(this, arguments);
    _this162.dragon = null;
    _this162.foot_ball = null;
    return _this162;
  }
  babel_createClass(d, [{
    key: "onLoad",
    value: function onLoad() {
      this.dragon = this.node.getComponent(sp.Skeleton);
      this.setSkin();
      this.dragon.setAnimation(0, "run2", true);
    }
  }, {
    key: "setSkin",
    value: function setSkin() {
      var _this163 = this;
      if ($2BundleManager.default.instance.getBundleRes("Spine", "zuqiuplayer/CH2", sp.SkeletonData)) {
        this.dragon.skeletonData = $2BundleManager.default.instance.getBundleRes("Spine", "zuqiuplayer/CH2", sp.SkeletonData);
        this.dragon.defaultSkin = "default";
        this.dragon.setSkin("default");
      } else {
        $2BundleManager.default.instance.loadBundleRes("Spine", "zuqiuplayer/CH2", sp.SkeletonData, function () {
          _this163.dragon.skeletonData = $2BundleManager.default.instance.getBundleRes("Spine", "zuqiuplayer/CH2", sp.SkeletonData);
          _this163.dragon.defaultSkin = "default";
          _this163.dragon.setSkin("default");
        });
      }
    }
  }, {
    key: "onCollisionEnter",
    value: function onCollisionEnter(e, t) {
      var _this164 = this;
      if ($2DataManager.default.instance.is_over) {
        return;
      }
      this.foot_ball = cc.instantiate($2BundleManager.default.instance.getBundleRes("Prefab", "Zuqiu/PlayerBall", cc.Prefab));
      this.foot_ball.parent = this.node.parent;
      this.foot_ball.getComponent(sp.Skeleton).setAnimation(1, "football", true);
      this.foot_ball.setPosition(t.node.position);
      var a = e.node.getComponent($2Jiangshi.default).dir.multiplyScalar(1500);
      console.log(a);
      var n = this.foot_ball.position.add(cc.v3(a.x, a.y));
      cc.tween(this.foot_ball).to(2, {
        position: n
      }).call(function () {
        _this164.foot_ball.removeFromParent();
      }).start();
      e.node.removeFromParent();
      var r = 0;
      this.schedule(function () {
        _this164.node.opacity = r % 2 == 0 ? 0 : 255;
        r++;
      }, .1, 3, 0);
      $2EventsMgr.EventsManager.emit("gameOver");
    }
  }]);
  return d;
}(cc.Component);
def_PlayerBall = cc__decorate([ccp_ccclass], def_PlayerBall);
exports.default = def_PlayerBall;